`include "i2c_env.sv"

class test_base extends uvm_test;
    `uvm_component_utils(test_base)

    i2c_env env;

    function new(string name, uvm_component parent);
        super.new(name, parent);
        `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
    endfunction

    virtual function void build_phase(uvm_phase phase);
        super.build_phase(phase);
        `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
        env = i2c_env::type_id::create("env", this);

        uvm_config_db#(virtual i2c_if)::set(this, "env.i_agent.*", "i2c_if", i2c_test_top.vif);
        uvm_config_db#(virtual i2c_if)::set(this, "env.r_agent.*", "i2c_if", i2c_test_top.vif);

        uvm_config_db #(int)::set(this, "env.*.seqr", "item_count", 20);
        //Lunch the apb_mst_seq to the apb_mst_sqr 
        uvm_config_db #(uvm_object_wrapper)::set(this, "env.i_agent.seqr.main_phase", "default_sequence", i2c_mst_seq::get_type());

    endfunction


    virtual function void connect_phase(uvm_phase phase);
        uvm_top.print_topology();
        factory.print();
    endfunction


    virtual function void final_phase(uvm_phase phase);
        super.final_phase(phase);
        `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
    endfunction
endclass